import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { Router } from '@angular/router';
@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  form = new Form('', '');
  constructor(private message: NzMessageService, private routers: Router) { }

  ngOnInit() {
  }
  login(): void {
    // console.log(this.router);
    if (this.form.username === 'admin' && this.form.password === 'admin') {
      this.message.create('success', 'login success');
      this.routers.navigate(['/main/test2']);
    } else {
      this.message.create('error', 'login error');
    }
  }
}

export class Form {
  constructor(
    public username: string,
    public password: string
  ) {  }
}
